FROM alpine

RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.3/main' > /etc/apk/repositories && \
    echo 'http://dl-cdn.alpinelinux.org/alpine/v3.3/community' >> /etc/apk/repositories && \
    rm -rf /var/cache/apk/* && \
    apk update && \
    apk add git && \
    git clone https://gitee.com/hacker61/ss5.git && \
    apk add gcc && \
    apk add g++ && \
    apk add make && \
    apk add linux-pam-dev && \
    apk add openldap-dev && \
    apk add linux-headers && \
    rm -rf /var/cache/apk/* && \
    cd /ss5/ && \
    ./configure && \
    make && \
    make install && \
    cd / && \
    apk del linux-headers && \
    apk del make && \
    apk del g++ && \
    apk del gcc && \
    rm -rf /ss5 && \
    apk del git && \
    rm -rf /var/cache/apk/*

COPY ss5.conf /etc/opt/ss5/ss5.conf

EXPOSE 18080
#ENV SS5_OPTS=" -u root -b 0.0.0.0:18080"
#ENV SS5_LIB_PATH=/usr/lib

ENTRYPOINT ["/usr/sbin/ss5", "-f", "-u", "root", "-b", "0.0.0.0:18080"]
#CMD ["/usr/sbin/ss5", "-u", "root", "-b", "0.0.0.0:18080"]
#ENTRYPOINT ["sh"]

#RUN wget http://jaist.dl.sourceforge.net/project/ss5/ss5/3.8.9-8/ss5-3.8.9-8.tar.gz
#RUN tar -zxvf ss5-3.8.9-8.tar.gz -C /root/
#RUN rm -rf ss5-3.8.9-8.tar.gz
#RUN cd /root/ss5-3.8.9/
#RUN ./configure
#RUN make && make install
